<template>
  <div>
    <a-card :bordered="false">
      <detail-list style="margin-top: 10px; font-size: 14px;">
        <detail-list-item term="培养方案模板名称">{{ temInfo.pyfamb.fambmc }}&emsp;</detail-list-item>
        <detail-list-item term="学生类型">{{ temInfo.pyfamb.xslxmc }}&emsp;</detail-list-item>
        <detail-list-item term="培养模式">{{ temInfo.pyfamb.pymsmc }}&emsp;</detail-list-item>
      </detail-list>
    </a-card>
    <a-card :bordered="false">
      <h4>培养方案模板学分要求</h4>
      <credit :pymsmc="temInfo.pyfamb.pymsmc" :edit="true" ref="credit"/>
    </a-card>

    <a-card :bordered="false">
      <h4>模板课程信息列表</h4>
      <a-table
        :columns="columns"
        :dataSource="temInfo.pyfambkcList"
        :alert="{show: false}"
        size="middle"
        :pagination="false"
      >
        <span slot="bxhxx" slot-scope="text">{{ text === '0' ? '选修' : '必修' }}</span>
        <span slot="sfxwk" slot-scope="text">{{ text === '0' ? '否' : '是' }}</span>
      </a-table>
    </a-card>

    <a-card :bordered="false">
      <h4 style="margin-top: 10px;">模板培养过程列表</h4>
      <a-table
        :columns="pcolumns"
        :dataSource="temInfo.pyfambPkcList"
        :alert="{show: false}"
        size="middle"
        :pagination="false"
      >
        <span slot="bxhxx" slot-scope="text">{{ text === '0' ? '选修' : '必修' }}</span>
        <span slot="sfxwk" slot-scope="text">{{ text === '0' ? '否' : '是' }}</span>
      </a-table>
    </a-card>

    <a-card :bordered="false">
      <h4 style="margin-top: 10px;">适用范围列表</h4>
      <a-table
        :columns="fwColumns"
        :dataSource="temInfo.pyfambfwList"
        :alert="{show: false}"
        size="middle"
        :pagination="false"
      >
      </a-table>
    </a-card>
    <div class="ant-pro-footer-toolbar">
      <a-button style="float: right;margin-top: 10px;" @click="back" type="primary">返回</a-button>
    </div>
  </div>
</template>

<script>

import DetailList from '~/tool/DetailList'
import credit from './add/credit'
const DetailListItem = DetailList.Item

export default {
  data () {
    return {
      temInfo: {
        pyfamb: {},
        pyfambfwList: [],
        pyfambkcList: [],
        pyfambPkcList: []
      },
      columns: [
        {
          title: '课程代码',
          dataIndex: 'kcdm',
          width: '15%'
        },
        {
          title: '课程名称',
          dataIndex: 'kcmc',
          width: '20%'
        },
        {
          title: '学时',
          width: 80,
          dataIndex: 'xs'
        },
        {
          title: '学分',
          width: 80,
          dataIndex: 'xf'
        },
        {
          title: '课程类型',
          dataIndex: 'kclxmc',
          width: '10%'
        },
        {
          title: '是否学位课',
          dataIndex: 'sfxwkmc',
          width: 100
        },
        {
          title: '修课要求',
          dataIndex: 'bxhxxmc',
          width: 80
        }
      ],
      pcolumns: [
        {
          title: '课程代码',
          dataIndex: 'kcdm',
          width: '15%'
        },
        {
          title: '课程名称',
          dataIndex: 'kcmc',
          width: '20%'
        },
        {
          title: '学时',
          dataIndex: 'xs'
        },
        {
          title: '学分',
          dataIndex: 'xf'
        },
        {
          title: '课程类型',
          dataIndex: 'kclxmc',
          width: '10%'
        }
      ],
      fwColumns: [
        {
          title: '一级学科/专业领域名称',
          dataIndex: 'xkmc'
        }
      ]
    }
  },
  components: {
    DetailList,
    DetailListItem,
    credit
  },
  created () {
    this.$api.cultivate.templateDetail(this.$route.params.id).then(res => {
      this.temInfo = res.data
      this.$refs.credit.form.setFieldsValue(res.data.pyfamb)
      if (res.data.pyfamb.pymsm === '01') {
        this.fwColumns = [{
          title: '门类',
          dataIndex: 'mlxkmc',
          width:100
        },{
          title: '一级学科',
          dataIndex: 'xkmc'
        }]
      }
    })
  },
  methods: {
    back () {
      this.$router.back()
    }
  }
}
</script>

<style>

</style>
